package autowire_anno;


import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

public class AutoWireMain {

	public AutoWireMain(){
		/*Resource rs = new ClassPathResource("autowire_xml/autowire_xml.xml");
		BeanFactory factory = new XmlBeanFactory(rs);
		*/
		ApplicationContext factory =  new ClassPathXmlApplicationContext("autowire_anno/autowire_anno.xml");
		
		
		
		//수동 wire
		AutoWirebyAnno manual= (AutoWirebyAnno)factory.getBean("manual");
		System.out.println(manual);
		
		//auto wire
		AutoWirebyAnno auto = (AutoWirebyAnno)factory.getBean("auto");
		System.out.println(auto);
	}
	public static void main(String[] args){
		new AutoWireMain();
	}
	
	
}

/*
_________________            ___________________             _______________
Data             |          |AutoWirebyAnno		|			|AutoWireMain	|
_________________|			|___________________|			|_______________|
+mid     		 |			|+Data data			|			|				|
+pwd			 |-------<> |___________________|<--------- |_______________|
_________________|			|+getData()			|			|+AutoWireMain()|
+getMid()		 |			|+setData(Data d)   |			|_______________|
+getPwd()		 |			|+String toString() |			
+setMid(String)  |			|___________________|
+setPwd(String)  |
_________________|*/